修复 singbox 内核 ECS 获取失败导致启动 FATAL#1301
Open
abcfy2 wants to merge 2 commits into
Open
Conversation
singbox_modify.sh 之前 ecs_address 为空时仍写入 client_subnet:"",
导致 sing-box 启动时 netip.ParsePrefix("") 报 'no /' FATAL,
服务无法启动。根因是 get_ecsip.sh 在部分环境(如梅林 resolv.conf
无 # Interface wan 标记、members.3322.org 被限流)下拿不到公网 IP。
- singbox_modify.sh: 与 mihomo 分支对齐,加 [ -n ecs_address ] 判空,
失败时不写字段并 logger 告警
- clash_modify.sh: logger 补颜色码 33(黄色),使告警同样打印到终端,
原来无颜色码只写日志文件用户无感知
原轮询 [ -n "$ip" ] 只判非空,members.3322.org 被限流返回 429 HTML 错误页时也判为成功 return,后续更可靠的源不会被尝试。 - 每个响应用 grep -oE 提取合法 IPv4,提取失败(HTML/空)则继续下一个 - 新增 http://ddns.oray.com/checkip 放首位(响应含 'Current IP Address:' 前缀,grep 提取末尾 IPv4),比 3322 免费 DDNS 更稳定 - 移除 http://4.ipw.cn(部分运营商 DNS 解析失败)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
开启 ECS 优化(
ecs_subnet=ON)后,get_ecsip.sh获取公网 IP 失败时,singbox_modify.sh仍写入空值"client_subnet": "",导致 sing-box 启动 FATAL:mihomo 分支因已有判空保护不受影响。
另外
get_ecsip.sh的公网 IP 轮询形同虚设:[ -n "$ip" ]只判非空,members.3322.org被限流返回 429 HTML 错误页时也判为成功 return,后续更可靠的源不会被尝试。修复
get_ecsip.sh:每个响应用grep -oE提取合法 IPv4,提取失败(HTML/空)则继续轮询下一个;新增ddns.oray.com/checkip放首位(响应为Current IP Address: x.x.x.x,grep 提取末尾 IPv4),移除部分运营商不可解析的4.ipw.cnsingbox_modify.sh:补ecs_address判空,失败时不写字段,与 mihomo 分支对齐clash_modify.sh:原告警logger缺颜色码只写日志不打印终端,补33